# references https://martin.hoppenheit.info/blog/2015/set-windows-proxy-with-powershell/

# 代理设置的注册表位置 It basically boils down to knowing the right registry entry:
$reg = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"

# 获取代理配置 Get the current proxy server and whether it is enabled:
$settings = Get-ItemProperty -Path $reg

echo 'Old proxy Server'
$settings.ProxyServer
$settings.ProxyEnable

# Configure a proxy server and enable it:
Set-ItemProperty -Path $reg -Name ProxyServer -Value "10.68.211.5:80"
Set-ItemProperty -Path $reg -Name ProxyEnable -Value 1

$settings = Get-ItemProperty -Path $reg
echo 'New proxy Server'
$settings.ProxyServer
$settings.ProxyEnable